
*************************************************************************************************

**ECONOMETRIC ANALYSIS

*************************************************************************************************

use "Military dataset.dta"

****************
**TABLE 1: Draft-eligibility status**
****************

*The population proportions comes from:
* Galiani, Sebastian, Martín A. Rossi, and Ernesto Schargrodsky (2011). “Conscription and Crime: Evidence from the Argentine Draft Lottery.” American Economic Journal: Applied Economics 3 (April), 119-136.

ttest ITT = 0.825 if Clase==1958
ttest ITT = 0.680 if Clase==1959  
ttest ITT = 0.659 if Clase==1960
ttest ITT = 0.650 if Clase==1961   
ttest ITT = 0.680 if Clase==1962  
ttest ITT = 0.650 if Clase==1963
ttest ITT = 0.600 if Clase==1964
ttest ITT = 0.607 if Clase==1965 
ttest ITT = 0.373 if Clase==1966 
ttest ITT = 0.333 if Clase==1967 
ttest ITT = 0.413 if Clase==1968 
ttest ITT = 0.446 if Clase==1969 
ttest ITT = 0.502 if Clase==1970 
ttest ITT = 0.281 if Clase==1971 
ttest ITT = 0.164 if Clase==1972
ttest ITT = 0.240 if Clase==1973  
ttest ITT = 0.226 if Clase==1974 
ttest ITT = 0.257 if Clase==1975 
ttest ITT = 0.477

****************
**FIGURE 1
****************

preserve 
drop if Clase==1976
gen dn=.
replace dn=0 if dni<=100
replace dn=1 if dni>100 & dni<=200
replace dn=2 if dni>200 & dni<=300
replace dn=3 if dni>300 & dni<=400
replace dn=4 if dni>400 & dni<=500
replace dn=5 if dni>500 & dni<=600
replace dn=6 if dni>600 & dni<=700
replace dn=7 if dni>700 & dni<=800
replace dn=8 if dni>800 & dni<=900
replace dn=9 if dni>900 & dni<=1000
histogram dn, discrete percent barwidth(0.8) bcolor(gray) xlabel(0(1)9) xlabel(0 "1-100" 1 "101-200" 2 "201-300" 3 "301-400" 4 "401-500" 5 "501-600" 6 "601-700" 7 "701-800" 8 "801-900" 9 "901-1000", angle(45)) ylabel(0(10)100) xtitle("") graphregion(color(white)) ytitle("Probability") ylabel(0(10)100) ylabel(0 "0" 10 ".1" 20 ".2" 30 ".3" 40 ".4" 50 ".5" 60 ".6" 70 ".7" 80 ".8" 90 ".9" 100 "1")
graph save Figure1.gph
restore

preserve
gen num=1
collapse (count) num, by (dni)
chitest num
restore

****************
**TABLE 2: Pre-treatment characteristics, by draft-eligibility assignment**
****************

**Columns 2 and 3
estpost tabstat nacpadre nacmadre padreSM nivelpadre* nivelmadre*, by(ITT) statistics(mean sd) columns(statistics) listwise
esttab ., main(mean) aux(sd) nostar unstack noobs nonote 
**Column 4
estpost ttest nacpadre nacmadre padreSM nivelpadre* nivelmadre*, by(ITT) 
esttab, se nostar obslast
estpost ttest nacpadre nacmadre padreSM nivelpadre* nivelmadre*, by(ITT) 
esttab ., main(p) nostar unstack

****************
**TABLA 3: Main results
****************

ivreg2 indpersonality (SM = ITT) clase* if Clase<1976, cluster (idCohort) first
outreg2 using Table3.doc, dec(3) title("Table 3. Main results") nor label nonotes addnote() replace
ivreg2 indpersonality (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23 if Clase<1976, cluster (idCohort) first
outreg2 using Table3.doc, dec(3) nor label append
ivreg2 indbeliefs (SM = ITT) clase* if Clase<1976, cluster (idCohort) first
outreg2 using Table3.doc, dec(3) nor label append
ivreg2 indbeliefs (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23 if Clase<1976, cluster (idCohort) first
outreg2 using Table3.doc, dec(3) nor label append

****************
**TABLE 4 PANEL A: Impact of mandatory military conscription on personality traits and beliefs, by outcome**
****************

ivregress 2sls tolerance (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) title("Table 4. Impact of mandatory military conscription on personality traits and beliefs, by outcome") nor label nonotes addnote(Notes: Standard errors clustered at the ID-cohort level are in parentheses. FDR-p-values are False Discovery Rates adjusted p values, following the procedure in Benjamini, Krieger, and Yekutieli (2006). All models are estimated using 2SLS. Conscription is instrumented using Draft Eligible. All models include cohort dummies. The set of controls includes district of origin dummies and all variables listed in Table 2. Percentage change is calculated relative to the mean of the outcome in the draft-ineligible group. *Significant at the 10% level. **Significant at the 5% level. ***Significant at the 1% level.) replace
ivregress 2sls discipline (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls conservatism (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls authoritarianism (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls belligerence (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls armas (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls conflicto (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls intervencion (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls SMobligatorio (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append
ivregress 2sls golpedeestado (SM = ITT) clase*, vce(cluster idCohort)
outreg2 using Table4A.doc, keep(SM) dec(3) nor label append

***False Discovery Rate p-values

*Generate a matrix
matrix IV = J(10,2,.)
matrix list IV

matrix IV [1, 1] =  1
matrix IV [2, 1] =  2
matrix IV [3, 1] =  3
matrix IV [4, 1] =  4
matrix IV [5, 1] =  5
matrix IV [6, 1] =  6
matrix IV [7, 1] =  7
matrix IV [8, 1] =  8
matrix IV [9, 1] =  9
matrix IV [10, 1] =  10
matrix list IV

ivregress 2sls tolerance (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [1, 2] =  r(p)
matrix list IV

ivregress 2sls discipline (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [2, 2] =  r(p)
matrix list IV

ivregress 2sls conservatism (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [3, 2] =  r(p)
matrix list IV

ivregress 2sls authoritarianism (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [4, 2] =  r(p)
matrix list IV

ivregress 2sls belligerence (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [5, 2] =  r(p)
matrix list IV

ivregress 2sls armas (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [6, 2] =  r(p)
matrix list IV

ivregress 2sls conflicto (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [7, 2] =  r(p)
matrix list IV

ivregress 2sls intervencion (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [8, 2] =  r(p)
matrix list IV

ivregress 2sls SMobligatorio (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [9, 2] =  r(p)
matrix list IV

ivregress 2sls golpedeestado (SM = ITT) clase*, vce(cluster idCohort)
test SM
matrix IV [10, 2] =  r(p)
matrix list IV

**This matrix generates a database to run the dofile "fdr_sharpened_qvalues" from:
** Anderson, Michael L. 2008. “Multiple Inference and Gender Differences in the Effects of Early Intervention: A Reevaluation of the Abecedarian, Perry Preschool, and Early Training Projects.” Journal of the American Statistical Association 103 (484): 1481–95
** https://are.berkeley.edu/~mlanderson/ARE_Website/Research.html 

****************
**TABLE 4 PANEL B: Impact of mandatory military conscription on personality traits and beliefs, by outcome**
****************

ivregress 2sls tolerance (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) title("Table 4. Impact of mandatory military conscription on personality traits and beliefs, by outcome") nor label nonotes addnote(Notes: Standard errors clustered at the ID-cohort level are shown in parentheses. FDR-p-values are False Discovery Rates adjusted p-values, following the procedure in Benjamin, Krieger, and Yekutieli (2006). All models are estimated using 2SLS. Conscription is instrumented using Draft Eligible. All models include cohort dummies. The set of controls includes district of origin dummies and all variables listed in Table 2. Percentage change is calculated relative to the mean of the outcome in the draft-ineligible group. *Significant at the 10% level. **Significant at the 5% level. ***Significant at the 1% level.) replace
ivregress 2sls discipline (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls conservatism (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls authoritarianism (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls belligerence (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls armas (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls conflicto (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls intervencion (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls SMobligatorio (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append
ivregress 2sls golpedeestado (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
outreg2 using Table4B.doc, keep(SM) dec(3) nor label append

***False Discovery Rate p-values

*Generate a matrix

matrix IV = J(10,2,.)
matrix list IV

matrix IV [1, 1] =  1
matrix IV [2, 1] =  2
matrix IV [3, 1] =  3
matrix IV [4, 1] =  4
matrix IV [5, 1] =  5
matrix IV [6, 1] =  6
matrix IV [7, 1] =  7
matrix IV [8, 1] =  8
matrix IV [9, 1] =  9
matrix IV [10, 1] =  10
matrix list IV

ivregress 2sls tolerance (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [1, 2] =  r(p)
matrix list IV

ivregress 2sls discipline (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [2, 2] =  r(p)
matrix list IV

ivregress 2sls conservatism (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [3, 2] =  r(p)
matrix list IV

ivregress 2sls authoritarianism (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [4, 2] =  r(p)
matrix list IV

ivregress 2sls belligerence (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [5, 2] =  r(p)
matrix list IV

ivregress 2sls armas (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [6, 2] =  r(p)
matrix list IV

ivregress 2sls conflicto (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [7, 2] =  r(p)
matrix list IV

ivregress 2sls intervencion (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [8, 2] =  r(p)
matrix list IV

ivregress 2sls SMobligatorio (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [9, 2] =  r(p)
matrix list IV

ivregress 2sls golpedeestado (SM = ITT) clase* nacpadre nacmadre padreSM edupadre edumadre nivelpadre* nivelmadre* BSASCABA pcia3-pcia23, vce(cluster idCohort)
test SM
matrix IV [10, 2] =  r(p)
matrix list IV

**This matrix generates a database to run the dofile "fdr_sharpened_qvalues" from Anderson (2008)





